//common/sql.js
module.exports = {
    users: {
        login: "select * from users where (userId=? or username=?) and pwd=?;",
        regist: "insert into users (gender, username, phone, pwd, avatar) values (?, ?, ?, ?, ?);",
        logout: "update users set isOnline=0 where userId=?;",
        get_user_info: "select * from users where userId=? or username=?;",
        get_users_info: "select * from users ",
        get_oline_user: "select * from users where isOnline=1;",
        update_user_login: "update users set lastLogin=?,isOnline=? where userId=?;",
        update_user_info: "update users set username=?,pwd=?,phone=?,gender=?,avatar=? where userId=?;",
        update_user_record: "update users set wins = wins + ?, losses = losses + ?, draws = draws + ? where userId = ?;",
    },
    record: {
        get_all_record: "select * from record;",
        get_user_record: "select * from record where black_user_id=? or white_user_id=?;",
        add_record: "insert into record values(0,?,?,?,?,?,?,?);",

    }
}